package com.hsc.www.stream3;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.web.ServerProperties;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.cloud.stream.messaging.Processor;
import org.springframework.stereotype.Component;

@Component
public class StreamReceiver {
    @Autowired
    ServerProperties serverProperties;

    private Logger log = LoggerFactory.getLogger(StreamReceiver.class);

    @StreamListener(Processor.INPUT)
    public void receive(String message) {


        log.info("{}收到: {}",serverProperties.getPort(), message);
        int a= 1/0;

    }

    @StreamListener(Processor.INPUT)
    public void receive2(String message) {


        log.info("{}收到: {}",serverProperties.getPort(), message);
        int a= 1/0;

    }
}